﻿/**  版本信息模板在安装目录下，可自行修改。
* T_PurchaseOrderDetails.cs
*
* 功 能： N/A
* 类 名： T_PurchaseOrderDetails
*
* Ver    变更日期             负责人  变更内容
* ───────────────────────────────────
* V0.01  2017/5/8 星期一 下午 10:35:03   N/A    初版
*
* Copyright (c) 2012 Maticsoft Corporation. All rights reserved.
*┌──────────────────────────────────┐
*│　此技术信息为本公司机密信息，未经本公司书面同意禁止向第三方披露．　│
*│　版权所有：动软卓越（北京）科技有限公司　　　　　　　　　　　　　　│
*└──────────────────────────────────┘
*/
using System;
using System.Data;
using System.Text;
using System.Data.SqlClient;
using SYDZ.WMS.DBUtility;//Please add references
namespace WMSAML.Warehouse.DAL
{
	/// <summary>
	/// 数据访问类:T_PurchaseOrderDetails
	/// </summary>
	public partial class T_PurchaseOrderDetails
	{
		public T_PurchaseOrderDetails()
		{}
		#region  BasicMethod



		/// <summary>
		/// 增加一条数据
		/// </summary>
		public int Add(WMSAML.Warehouse.Model.T_PurchaseOrderDetails model)
		{
			StringBuilder strSql=new StringBuilder();
			strSql.Append("insert into T_PurchaseOrderDetails(");
			strSql.Append("PurchaseOrder_Id,Organisation_Id,Group_Id,Factory_Short_Name,Product_Type,Consignee_Short_Name,Customer_Request_Date,Region_id,Final_Destination,Transport_Mode,Consignee_Order_No,Model_No,Qty_Ordered,Unit_Price,Currency_Id,Issued_Date,Customer_PO_Number,Order_Priority,Order_Type,Pwhseta,Swhseta,Created_On,Revision_Date,Consol_Pack_ID,Status,Create_time,Update_time,Update_user_id,BK01,BK02,BK03,BK04,BK05)");
			strSql.Append(" values (");
			strSql.Append("@PurchaseOrder_Id,@Organisation_Id,@Group_Id,@Factory_Short_Name,@Product_Type,@Consignee_Short_Name,@Customer_Request_Date,@Region_id,@Final_Destination,@Transport_Mode,@Consignee_Order_No,@Model_No,@Qty_Ordered,@Unit_Price,@Currency_Id,@Issued_Date,@Customer_PO_Number,@Order_Priority,@Order_Type,@Pwhseta,@Swhseta,@Created_On,@Revision_Date,@Consol_Pack_ID,@Status,@Create_time,@Update_time,@Update_user_id,@BK01,@BK02,@BK03,@BK04,@BK05)");
			strSql.Append(";select @@IDENTITY");
			SqlParameter[] parameters = {
					new SqlParameter("@PurchaseOrder_Id", SqlDbType.Int,4),
					new SqlParameter("@Organisation_Id", SqlDbType.NVarChar,200),
					new SqlParameter("@Group_Id", SqlDbType.NVarChar,200),
					new SqlParameter("@Factory_Short_Name", SqlDbType.NVarChar,200),
					new SqlParameter("@Product_Type", SqlDbType.NVarChar,200),
					new SqlParameter("@Consignee_Short_Name", SqlDbType.NVarChar,200),
					new SqlParameter("@Customer_Request_Date", SqlDbType.NVarChar,200),
					new SqlParameter("@Region_id", SqlDbType.NVarChar,200),
					new SqlParameter("@Final_Destination", SqlDbType.NVarChar,200),
					new SqlParameter("@Transport_Mode", SqlDbType.NVarChar,200),
					new SqlParameter("@Consignee_Order_No", SqlDbType.NVarChar,200),
					new SqlParameter("@Model_No", SqlDbType.NVarChar,200),
					new SqlParameter("@Qty_Ordered", SqlDbType.Decimal,9),
					new SqlParameter("@Unit_Price", SqlDbType.Decimal,9),
					new SqlParameter("@Currency_Id", SqlDbType.NVarChar,200),
					new SqlParameter("@Issued_Date", SqlDbType.NVarChar,200),
					new SqlParameter("@Customer_PO_Number", SqlDbType.NVarChar,200),
					new SqlParameter("@Order_Priority", SqlDbType.NVarChar,200),
					new SqlParameter("@Order_Type", SqlDbType.Int,4),
					new SqlParameter("@Pwhseta", SqlDbType.NVarChar,200),
					new SqlParameter("@Swhseta", SqlDbType.NVarChar,200),
					new SqlParameter("@Created_On", SqlDbType.NVarChar,200),
					new SqlParameter("@Revision_Date", SqlDbType.NVarChar,200),
					new SqlParameter("@Consol_Pack_ID", SqlDbType.NVarChar,200),
					new SqlParameter("@Status", SqlDbType.NVarChar,200),
					new SqlParameter("@Create_time", SqlDbType.VarChar,200),
					new SqlParameter("@Update_time", SqlDbType.VarChar,200),
					new SqlParameter("@Update_user_id", SqlDbType.VarChar,200),
					new SqlParameter("@BK01", SqlDbType.NVarChar,-1),
					new SqlParameter("@BK02", SqlDbType.NVarChar,-1),
					new SqlParameter("@BK03", SqlDbType.NVarChar,-1),
					new SqlParameter("@BK04", SqlDbType.NVarChar,-1),
					new SqlParameter("@BK05", SqlDbType.NVarChar,-1)};
			parameters[0].Value = model.PurchaseOrder_Id;
			parameters[1].Value = model.Organisation_Id;
			parameters[2].Value = model.Group_Id;
			parameters[3].Value = model.Factory_Short_Name;
			parameters[4].Value = model.Product_Type;
			parameters[5].Value = model.Consignee_Short_Name;
			parameters[6].Value = model.Customer_Request_Date;
			parameters[7].Value = model.Region_id;
			parameters[8].Value = model.Final_Destination;
			parameters[9].Value = model.Transport_Mode;
			parameters[10].Value = model.Consignee_Order_No;
			parameters[11].Value = model.Model_No;
			parameters[12].Value = model.Qty_Ordered;
			parameters[13].Value = model.Unit_Price;
			parameters[14].Value = model.Currency_Id;
			parameters[15].Value = model.Issued_Date;
			parameters[16].Value = model.Customer_PO_Number;
			parameters[17].Value = model.Order_Priority;
			parameters[18].Value = model.Order_Type;
			parameters[19].Value = model.Pwhseta;
			parameters[20].Value = model.Swhseta;
			parameters[21].Value = model.Created_On;
			parameters[22].Value = model.Revision_Date;
			parameters[23].Value = model.Consol_Pack_ID;
			parameters[24].Value = model.Status;
			parameters[25].Value = model.Create_time;
			parameters[26].Value = model.Update_time;
			parameters[27].Value = model.Update_user_id;
			parameters[28].Value = model.BK01;
			parameters[29].Value = model.BK02;
			parameters[30].Value = model.BK03;
			parameters[31].Value = model.BK04;
			parameters[32].Value = model.BK05;

			object obj = DbHelperSQL.GetSingle(strSql.ToString(),parameters);
			if (obj == null)
			{
				return 0;
			}
			else
			{
				return Convert.ToInt32(obj);
			}
		}
		/// <summary>
		/// 更新一条数据
		/// </summary>
		public bool Update(WMSAML.Warehouse.Model.T_PurchaseOrderDetails model)
		{
			StringBuilder strSql=new StringBuilder();
			strSql.Append("update T_PurchaseOrderDetails set ");
			strSql.Append("PurchaseOrder_Id=@PurchaseOrder_Id,");
			strSql.Append("Organisation_Id=@Organisation_Id,");
			strSql.Append("Group_Id=@Group_Id,");
			strSql.Append("Factory_Short_Name=@Factory_Short_Name,");
			strSql.Append("Product_Type=@Product_Type,");
			strSql.Append("Consignee_Short_Name=@Consignee_Short_Name,");
			strSql.Append("Customer_Request_Date=@Customer_Request_Date,");
			strSql.Append("Region_id=@Region_id,");
			strSql.Append("Final_Destination=@Final_Destination,");
			strSql.Append("Transport_Mode=@Transport_Mode,");
			strSql.Append("Consignee_Order_No=@Consignee_Order_No,");
			strSql.Append("Model_No=@Model_No,");
			strSql.Append("Qty_Ordered=@Qty_Ordered,");
			strSql.Append("Unit_Price=@Unit_Price,");
			strSql.Append("Currency_Id=@Currency_Id,");
			strSql.Append("Issued_Date=@Issued_Date,");
			strSql.Append("Customer_PO_Number=@Customer_PO_Number,");
			strSql.Append("Order_Priority=@Order_Priority,");
			strSql.Append("Order_Type=@Order_Type,");
			strSql.Append("Pwhseta=@Pwhseta,");
			strSql.Append("Swhseta=@Swhseta,");
			strSql.Append("Created_On=@Created_On,");
			strSql.Append("Revision_Date=@Revision_Date,");
			strSql.Append("Consol_Pack_ID=@Consol_Pack_ID,");
			strSql.Append("Status=@Status,");
			strSql.Append("Create_time=@Create_time,");
			strSql.Append("Update_time=@Update_time,");
			strSql.Append("Update_user_id=@Update_user_id,");
			strSql.Append("BK01=@BK01,");
			strSql.Append("BK02=@BK02,");
			strSql.Append("BK03=@BK03,");
			strSql.Append("BK04=@BK04,");
			strSql.Append("BK05=@BK05");
			strSql.Append(" where Details_Id=@Details_Id");
			SqlParameter[] parameters = {
					new SqlParameter("@PurchaseOrder_Id", SqlDbType.Int,4),
					new SqlParameter("@Organisation_Id", SqlDbType.NVarChar,200),
					new SqlParameter("@Group_Id", SqlDbType.NVarChar,200),
					new SqlParameter("@Factory_Short_Name", SqlDbType.NVarChar,200),
					new SqlParameter("@Product_Type", SqlDbType.NVarChar,200),
					new SqlParameter("@Consignee_Short_Name", SqlDbType.NVarChar,200),
					new SqlParameter("@Customer_Request_Date", SqlDbType.NVarChar,200),
					new SqlParameter("@Region_id", SqlDbType.NVarChar,200),
					new SqlParameter("@Final_Destination", SqlDbType.NVarChar,200),
					new SqlParameter("@Transport_Mode", SqlDbType.NVarChar,200),
					new SqlParameter("@Consignee_Order_No", SqlDbType.NVarChar,200),
					new SqlParameter("@Model_No", SqlDbType.NVarChar,200),
					new SqlParameter("@Qty_Ordered", SqlDbType.Decimal,9),
					new SqlParameter("@Unit_Price", SqlDbType.Decimal,9),
					new SqlParameter("@Currency_Id", SqlDbType.NVarChar,200),
					new SqlParameter("@Issued_Date", SqlDbType.NVarChar,200),
					new SqlParameter("@Customer_PO_Number", SqlDbType.NVarChar,200),
					new SqlParameter("@Order_Priority", SqlDbType.NVarChar,200),
					new SqlParameter("@Order_Type", SqlDbType.Int,4),
					new SqlParameter("@Pwhseta", SqlDbType.NVarChar,200),
					new SqlParameter("@Swhseta", SqlDbType.NVarChar,200),
					new SqlParameter("@Created_On", SqlDbType.NVarChar,200),
					new SqlParameter("@Revision_Date", SqlDbType.NVarChar,200),
					new SqlParameter("@Consol_Pack_ID", SqlDbType.NVarChar,200),
					new SqlParameter("@Status", SqlDbType.NVarChar,200),
					new SqlParameter("@Create_time", SqlDbType.VarChar,200),
					new SqlParameter("@Update_time", SqlDbType.VarChar,200),
					new SqlParameter("@Update_user_id", SqlDbType.VarChar,200),
					new SqlParameter("@BK01", SqlDbType.NVarChar,-1),
					new SqlParameter("@BK02", SqlDbType.NVarChar,-1),
					new SqlParameter("@BK03", SqlDbType.NVarChar,-1),
					new SqlParameter("@BK04", SqlDbType.NVarChar,-1),
					new SqlParameter("@BK05", SqlDbType.NVarChar,-1),
					new SqlParameter("@Details_Id", SqlDbType.Int,4)};
			parameters[0].Value = model.PurchaseOrder_Id;
			parameters[1].Value = model.Organisation_Id;
			parameters[2].Value = model.Group_Id;
			parameters[3].Value = model.Factory_Short_Name;
			parameters[4].Value = model.Product_Type;
			parameters[5].Value = model.Consignee_Short_Name;
			parameters[6].Value = model.Customer_Request_Date;
			parameters[7].Value = model.Region_id;
			parameters[8].Value = model.Final_Destination;
			parameters[9].Value = model.Transport_Mode;
			parameters[10].Value = model.Consignee_Order_No;
			parameters[11].Value = model.Model_No;
			parameters[12].Value = model.Qty_Ordered;
			parameters[13].Value = model.Unit_Price;
			parameters[14].Value = model.Currency_Id;
			parameters[15].Value = model.Issued_Date;
			parameters[16].Value = model.Customer_PO_Number;
			parameters[17].Value = model.Order_Priority;
			parameters[18].Value = model.Order_Type;
			parameters[19].Value = model.Pwhseta;
			parameters[20].Value = model.Swhseta;
			parameters[21].Value = model.Created_On;
			parameters[22].Value = model.Revision_Date;
			parameters[23].Value = model.Consol_Pack_ID;
			parameters[24].Value = model.Status;
			parameters[25].Value = model.Create_time;
			parameters[26].Value = model.Update_time;
			parameters[27].Value = model.Update_user_id;
			parameters[28].Value = model.BK01;
			parameters[29].Value = model.BK02;
			parameters[30].Value = model.BK03;
			parameters[31].Value = model.BK04;
			parameters[32].Value = model.BK05;
			parameters[33].Value = model.Details_Id;

			int rows=DbHelperSQL.ExecuteSql(strSql.ToString(),parameters);
			if (rows > 0)
			{
				return true;
			}
			else
			{
				return false;
			}
		}

		/// <summary>
		/// 删除一条数据
		/// </summary>
		public bool Delete(int Details_Id)
		{
			
			StringBuilder strSql=new StringBuilder();
			strSql.Append("delete from T_PurchaseOrderDetails ");
			strSql.Append(" where Details_Id=@Details_Id");
			SqlParameter[] parameters = {
					new SqlParameter("@Details_Id", SqlDbType.Int,4)
			};
			parameters[0].Value = Details_Id;

			int rows=DbHelperSQL.ExecuteSql(strSql.ToString(),parameters);
			if (rows > 0)
			{
				return true;
			}
			else
			{
				return false;
			}
		}
        /// <summary>
        /// 删除一条数据
        /// </summary>
        public bool Delete1(int Details_Id)
        {

            StringBuilder strSql = new StringBuilder();
            strSql.Append("delete from T_PurchaseOrderDetails ");
            strSql.Append(" where PurchaseOrder_Id=@Details_Id");
            SqlParameter[] parameters = {
					new SqlParameter("@Details_Id", SqlDbType.Int,4)
			};
            parameters[0].Value = Details_Id;

            int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);
            if (rows > 0)
            {
                return true;
            }
            else
            {
                return false;
            }
        }
		/// <summary>
		/// 批量删除数据
		/// </summary>
		public bool DeleteList(string Details_Idlist )
		{
			StringBuilder strSql=new StringBuilder();
			strSql.Append("delete from T_PurchaseOrderDetails ");
			strSql.Append(" where Details_Id in ("+Details_Idlist + ")  ");
			int rows=DbHelperSQL.ExecuteSql(strSql.ToString());
			if (rows > 0)
			{
				return true;
			}
			else
			{
				return false;
			}
		}


		/// <summary>
		/// 得到一个对象实体
		/// </summary>
		public WMSAML.Warehouse.Model.T_PurchaseOrderDetails GetModel(int Details_Id)
		{
			
			StringBuilder strSql=new StringBuilder();
			strSql.Append("select  top 1 Details_Id,PurchaseOrder_Id,Organisation_Id,Group_Id,Factory_Short_Name,Product_Type,Consignee_Short_Name,Customer_Request_Date,Region_id,Final_Destination,Transport_Mode,Consignee_Order_No,Model_No,Qty_Ordered,Unit_Price,Currency_Id,Issued_Date,Customer_PO_Number,Order_Priority,Order_Type,Pwhseta,Swhseta,Created_On,Revision_Date,Consol_Pack_ID,Status,Create_time,Update_time,Update_user_id,BK01,BK02,BK03,BK04,BK05 from T_PurchaseOrderDetails ");
			strSql.Append(" where Details_Id=@Details_Id");
			SqlParameter[] parameters = {
					new SqlParameter("@Details_Id", SqlDbType.Int,4)
			};
			parameters[0].Value = Details_Id;

			WMSAML.Warehouse.Model.T_PurchaseOrderDetails model=new WMSAML.Warehouse.Model.T_PurchaseOrderDetails();
			DataSet ds=DbHelperSQL.Query(strSql.ToString(),parameters);
			if(ds.Tables[0].Rows.Count>0)
			{
				return DataRowToModel(ds.Tables[0].Rows[0]);
			}
			else
			{
				return null;
			}
		}


		/// <summary>
		/// 得到一个对象实体
		/// </summary>
		public WMSAML.Warehouse.Model.T_PurchaseOrderDetails DataRowToModel(DataRow row)
		{
			WMSAML.Warehouse.Model.T_PurchaseOrderDetails model=new WMSAML.Warehouse.Model.T_PurchaseOrderDetails();
			if (row != null)
			{
				if(row["Details_Id"]!=null && row["Details_Id"].ToString()!="")
				{
					model.Details_Id=int.Parse(row["Details_Id"].ToString());
				}
				if(row["PurchaseOrder_Id"]!=null && row["PurchaseOrder_Id"].ToString()!="")
				{
					model.PurchaseOrder_Id=int.Parse(row["PurchaseOrder_Id"].ToString());
				}
				if(row["Organisation_Id"]!=null)
				{
					model.Organisation_Id=row["Organisation_Id"].ToString();
				}
				if(row["Group_Id"]!=null)
				{
					model.Group_Id=row["Group_Id"].ToString();
				}
				if(row["Factory_Short_Name"]!=null)
				{
					model.Factory_Short_Name=row["Factory_Short_Name"].ToString();
				}
				if(row["Product_Type"]!=null)
				{
					model.Product_Type=row["Product_Type"].ToString();
				}
				if(row["Consignee_Short_Name"]!=null)
				{
					model.Consignee_Short_Name=row["Consignee_Short_Name"].ToString();
				}
				if(row["Customer_Request_Date"]!=null)
				{
					model.Customer_Request_Date=row["Customer_Request_Date"].ToString();
				}
				if(row["Region_id"]!=null)
				{
					model.Region_id=row["Region_id"].ToString();
				}
				if(row["Final_Destination"]!=null)
				{
					model.Final_Destination=row["Final_Destination"].ToString();
				}
				if(row["Transport_Mode"]!=null)
				{
					model.Transport_Mode=row["Transport_Mode"].ToString();
				}
				if(row["Consignee_Order_No"]!=null)
				{
					model.Consignee_Order_No=row["Consignee_Order_No"].ToString();
				}
				if(row["Model_No"]!=null)
				{
					model.Model_No=row["Model_No"].ToString();
				}
				if(row["Qty_Ordered"]!=null && row["Qty_Ordered"].ToString()!="")
				{
					model.Qty_Ordered=decimal.Parse(row["Qty_Ordered"].ToString());
				}
				if(row["Unit_Price"]!=null && row["Unit_Price"].ToString()!="")
				{
					model.Unit_Price=decimal.Parse(row["Unit_Price"].ToString());
				}
				if(row["Currency_Id"]!=null)
				{
					model.Currency_Id=row["Currency_Id"].ToString();
				}
				if(row["Issued_Date"]!=null)
				{
					model.Issued_Date=row["Issued_Date"].ToString();
				}
				if(row["Customer_PO_Number"]!=null)
				{
					model.Customer_PO_Number=row["Customer_PO_Number"].ToString();
				}
				if(row["Order_Priority"]!=null)
				{
					model.Order_Priority=row["Order_Priority"].ToString();
				}
				if(row["Order_Type"]!=null && row["Order_Type"].ToString()!="")
				{
					model.Order_Type=int.Parse(row["Order_Type"].ToString());
				}
				if(row["Pwhseta"]!=null)
				{
					model.Pwhseta=row["Pwhseta"].ToString();
				}
				if(row["Swhseta"]!=null)
				{
					model.Swhseta=row["Swhseta"].ToString();
				}
				if(row["Created_On"]!=null)
				{
					model.Created_On=row["Created_On"].ToString();
				}
				if(row["Revision_Date"]!=null)
				{
					model.Revision_Date=row["Revision_Date"].ToString();
				}
				if(row["Consol_Pack_ID"]!=null)
				{
					model.Consol_Pack_ID=row["Consol_Pack_ID"].ToString();
				}
				if(row["Status"]!=null)
				{
					model.Status=row["Status"].ToString();
				}
				if(row["Create_time"]!=null)
				{
					model.Create_time=row["Create_time"].ToString();
				}
				if(row["Update_time"]!=null)
				{
					model.Update_time=row["Update_time"].ToString();
				}
				if(row["Update_user_id"]!=null)
				{
					model.Update_user_id=row["Update_user_id"].ToString();
				}
				if(row["BK01"]!=null)
				{
					model.BK01=row["BK01"].ToString();
				}
				if(row["BK02"]!=null)
				{
					model.BK02=row["BK02"].ToString();
				}
				if(row["BK03"]!=null)
				{
					model.BK03=row["BK03"].ToString();
				}
				if(row["BK04"]!=null)
				{
					model.BK04=row["BK04"].ToString();
				}
				if(row["BK05"]!=null)
				{
					model.BK05=row["BK05"].ToString();
				}
			}
			return model;
		}

		/// <summary>
		/// 获得数据列表
		/// </summary>
		public DataSet GetList(string strWhere)
		{
			StringBuilder strSql=new StringBuilder();
			strSql.Append("select Details_Id,PurchaseOrder_Id,Organisation_Id,Group_Id,Factory_Short_Name,Product_Type,Consignee_Short_Name,Customer_Request_Date,Region_id,Final_Destination,Transport_Mode,Consignee_Order_No,Model_No,Qty_Ordered,Unit_Price,Currency_Id,Issued_Date,Customer_PO_Number,Order_Priority,Order_Type,Pwhseta,Swhseta,Created_On,Revision_Date,Consol_Pack_ID,Status,Create_time,Update_time,Update_user_id,BK01,BK02,BK03,BK04,BK05 ");
			strSql.Append(" FROM T_PurchaseOrderDetails ");
			if(strWhere.Trim()!="")
			{
				strSql.Append(" where "+strWhere);
			}
			return DbHelperSQL.Query(strSql.ToString());
		}

		/// <summary>
		/// 获得前几行数据
		/// </summary>
		public DataSet GetList(int Top,string strWhere,string filedOrder)
		{
			StringBuilder strSql=new StringBuilder();
			strSql.Append("select ");
			if(Top>0)
			{
				strSql.Append(" top "+Top.ToString());
			}
			strSql.Append(" Details_Id,PurchaseOrder_Id,Organisation_Id,Group_Id,Factory_Short_Name,Product_Type,Consignee_Short_Name,Customer_Request_Date,Region_id,Final_Destination,Transport_Mode,Consignee_Order_No,Model_No,Qty_Ordered,Unit_Price,Currency_Id,Issued_Date,Customer_PO_Number,Order_Priority,Order_Type,Pwhseta,Swhseta,Created_On,Revision_Date,Consol_Pack_ID,Status,Create_time,Update_time,Update_user_id,BK01,BK02,BK03,BK04,BK05 ");
			strSql.Append(" FROM T_PurchaseOrderDetails ");
			if(strWhere.Trim()!="")
			{
				strSql.Append(" where "+strWhere);
			}
			strSql.Append(" order by " + filedOrder);
			return DbHelperSQL.Query(strSql.ToString());
		}

		/// <summary>
		/// 获取记录总数
		/// </summary>
		public int GetRecordCount(string strWhere)
		{
			StringBuilder strSql=new StringBuilder();
			strSql.Append("select count(1) FROM T_PurchaseOrderDetails ");
			if(strWhere.Trim()!="")
			{
				strSql.Append(" where "+strWhere);
			}
			object obj = DbHelperSQL.GetSingle(strSql.ToString());
			if (obj == null)
			{
				return 0;
			}
			else
			{
				return Convert.ToInt32(obj);
			}
		}
		/// <summary>
		/// 分页获取数据列表
		/// </summary>
		public DataSet GetListByPage(string strWhere, string orderby, int startIndex, int endIndex)
		{
			StringBuilder strSql=new StringBuilder();
			strSql.Append("SELECT * FROM ( ");
			strSql.Append(" SELECT ROW_NUMBER() OVER (");
			if (!string.IsNullOrEmpty(orderby.Trim()))
			{
				strSql.Append("order by T." + orderby );
			}
			else
			{
				strSql.Append("order by T.Details_Id desc");
			}
			strSql.Append(")AS Row, T.*  from T_PurchaseOrderDetails T ");
			if (!string.IsNullOrEmpty(strWhere.Trim()))
			{
				strSql.Append(" WHERE " + strWhere);
			}
			strSql.Append(" ) TT");
			strSql.AppendFormat(" WHERE TT.Row between {0} and {1}", startIndex, endIndex);
			return DbHelperSQL.Query(strSql.ToString());
		}

		/*
		/// <summary>
		/// 分页获取数据列表
		/// </summary>
		public DataSet GetList(int PageSize,int PageIndex,string strWhere)
		{
			SqlParameter[] parameters = {
					new SqlParameter("@tblName", SqlDbType.VarChar, 255),
					new SqlParameter("@fldName", SqlDbType.VarChar, 255),
					new SqlParameter("@PageSize", SqlDbType.Int),
					new SqlParameter("@PageIndex", SqlDbType.Int),
					new SqlParameter("@IsReCount", SqlDbType.Bit),
					new SqlParameter("@OrderType", SqlDbType.Bit),
					new SqlParameter("@strWhere", SqlDbType.VarChar,1000),
					};
			parameters[0].Value = "T_PurchaseOrderDetails";
			parameters[1].Value = "Details_Id";
			parameters[2].Value = PageSize;
			parameters[3].Value = PageIndex;
			parameters[4].Value = 0;
			parameters[5].Value = 0;
			parameters[6].Value = strWhere;	
			return DbHelperSQL.RunProcedure("UP_GetRecordByPage",parameters,"ds");
		}*/

		#endregion  BasicMethod
		#region  ExtensionMethod

		#endregion  ExtensionMethod
	}
}

